package com.mo.json;

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;

import java.io.IOException;

/**
 * @author moon.pan
 * @program mo-all
 * @apiNote
 * @since 2022/3/28
 */
public class StatusSerializer extends JsonSerializer<Integer> {
    @Override
    public void serialize(Integer status, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException {
        if (status == 0) {
            jsonGenerator.writeString("零");
        }else {
            jsonGenerator.writeString("other");
        }
    }
}
